package com.example.zhc36.keymanager.adapter;

import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.TextView;


import com.example.zhc36.keymanager.R;

import com.example.zhc36.keymanager.bean.Daomoli;


import java.util.List;

public class Adapter extends BaseAdapter {

    private  List<Daomoli> list;

    public Adapter(List<Daomoli> list) {
        this.list = list;
    }

    public List<Daomoli> getDate() {
        return list;
    }

    public void setDate(List<Daomoli> list) {
        this.list = list;
    }


    @Override
    public int getCount() {
        return list.size();
    }

    @Override
    public Object getItem(int i) {
        return null;
    }

    @Override
    public long getItemId(int i) {
        return 0;
    }

    @Override
    public View getView(int i, View view, ViewGroup viewGroup) {
        ViewHolder vh;
       view = LayoutInflater.from(viewGroup.getContext())
               .inflate(R.layout.listview,viewGroup,false);
          vh=new ViewHolder();
          vh.tv1=view.findViewById(R.id.tv1);
          vh.tv2=view.findViewById(R.id.tv2);
          vh.tv3=view.findViewById(R.id.tv3);

          view.setTag(vh);


          Daomoli mo=list.get(i);
          vh.p=mo;
          vh.tv1.setText(mo.getAddress());
          vh.tv2.setText(mo.getRoom());
          vh.tv3.setText(mo.getDate());







        return view;
    }
    class ViewHolder{
        TextView tv1;
        TextView tv2;
        TextView tv3;
        Daomoli p;


    }
}
